﻿using Microsoft.EntityFrameworkCore;
using NewRetail.Application.Components.Advertisement.Entity;
using NewRetail.Application.Core.Entity;

namespace NewRetail.Application.Components.Advertisement
{
    public static class AdvertExtension
    {
        public static void ConfigureAdvertEntities(this ModelBuilder modelBuilder)
        {
            //pos端副屏广告表
            var infoBuilder = modelBuilder.Entity<AdvertisementInfo>().ConfigBaseEntity();
            infoBuilder.ToTable("advertisement_info");
            infoBuilder.Property(x => x.warehouseId).IsRequired().HasMaxLength(50);
            infoBuilder.Property(x => x.fileName).IsRequired().HasMaxLength(500);
            infoBuilder.Property(x => x.extName).IsRequired().HasMaxLength(50);
            infoBuilder.Property(x => x.enclosureType).IsRequired();
            infoBuilder.Property(x => x.origionName).HasMaxLength(250);
            infoBuilder.Property(x => x.ossPath).HasMaxLength(200);
            infoBuilder.Property(x => x.IsDeleted).HasDefaultValue(false);
            infoBuilder.Property(x => x.sort).HasDefaultValue(1);
            infoBuilder.Ignore(x => x.Warehouse);
        }
    }
}
